import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

//用于下拉刷新 头布局
class RefreshCustomHeaderWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return WaterDropHeader(
      refresh: CircularProgressIndicator(),
      complete: Text(
        "刷新完成",
        style: TextStyle(fontSize: 14),
      ),
      // idleIcon: new CircularProgressIndicator(),
      // waterDropColor: null,
    );
  }
}

//用于上拉加载 底部布局
class RefreshCustomFooterWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CustomFooter(
      builder: (context, mode) {
        Widget body;
        if (mode == LoadStatus.idle) {
          body = Text(
            "上拉加载",
            style: TextStyle(fontSize: 14),
          );
        } else if (mode == LoadStatus.loading) {
          body = CupertinoActivityIndicator();
        } else if (mode == LoadStatus.failed) {
          body = Text(
            "加载失败",
            style: TextStyle(fontSize: 14),
          );
        } else if (mode == LoadStatus.canLoading) {
          body = Text(
            "松开加载更多",
            style: TextStyle(fontSize: 14),
          );
        } else if (mode == LoadStatus.noMore) {
          body = Text(
            "没有更多数据",
            style: TextStyle(fontSize: 14),
          );
        } else {
          body = Text("2222");
        }
        return Container(
          height: 55.0,
          child: Center(child: body),
        );
      },
    );
  }
}
